package com.hk.config;

import com.alibaba.druid.pool.DruidDataSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

@Configuration
@ComponentScan(basePackages = "com")
@PropertySource(value = "DataSource.properties")
public class Config {
    @Bean
    public DruidDataSource druidDataSource(){
        DruidDataSource druidDataSource=new DruidDataSource();
        druidDataSource.setDriverClassName("${mysql.driver}");
        druidDataSource.setUrl("${mysql.url}");
        druidDataSource.setUsername("${mysql.username}");
        druidDataSource.setPassword("${mysql.password}");
        return druidDataSource;
    }
}
